import Vue from 'vue'

const component2 = {
  template: `<div>

{{yeye.value}}---
<input type="text" v-model="yeye.value">
</div>`,
  inject: [
    'yeye'
  ],
  data () {
    return {

    }
  },
  mounted () {
    console.log(this.yeye)
    console.log(this.$parent.value);
  }

}

const component1 = {
  components: {
    component2
  },
  template: `<div><component2></component2></div>`,
  data () {
    return {
      value: '123123'
    }
  }
}

new Vue({
  components: {
    component1
  },
  provide () {
    return {
      yeye: this
    }
  },
  data () {
    return {
      value: 'aaa123',
    }
  },
  template: `<div><component1></component1></div>`,
  el: '#app'
})
